package com.example.schoolhelp.util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by user on 2016/10/20.
 */
public class AbSharePreferences {
    SharedPreferences sp;

    public AbSharePreferences(Context context) {
        sp = context.getSharedPreferences("softUseInfo.xml", Context.MODE_PRIVATE);
    }


    public boolean getBooleanValue(String key, boolean defaultValue) {
        boolean b = sp.getBoolean(key, defaultValue);
        return b;

    }

    public int getIntValue(String key, int defaultValue) {
        int i = sp.getInt(key, defaultValue);
        return i;
    }

    public String getStringValue(String key, String defaultValue) {
        String s = sp.getString(key, defaultValue);
        return s;
    }

    public void putBooleanValue(String key, boolean b){
        SharedPreferences.Editor edit = sp.edit();
        edit.putBoolean(key, b);
        edit.commit();
    }

    public void putIntValue(String key, int i){
        SharedPreferences.Editor edit = sp.edit();
        edit.putInt(key, i);
        edit.commit();
    }

     public void putStringValue(String key, String s){
         SharedPreferences.Editor edit = sp.edit();
         edit.putString(key, s);
         edit.commit();
     }






}